#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libImg2Movie.h"
#include <string>

extern "C" {
#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#include <libavutil/imgutils.h>
}
class MovieEncoder
{
public:
	MovieEncoder();
	virtual ~MovieEncoder();

	//
	int Init(const char* name, TMovParam param);
	int AddFrame(PTImageData pimg);
	int Finalize();

protected:
	void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,
		FILE *outfile);

private:
	int stage;
	AVCodec *codec;
	AVCodecContext *c;
	FILE *f;
	AVFrame *frame;
	AVPacket *pkt;
	long long pts;
};

